def solve(nums):
    nums_set = set(nums)
    len = 0
    for num in nums_set:
        if num - 1 not in nums_set:
            length_temp = 1
            while num + 1 in nums_set:
                length_temp += 1
                num += 1
            len = max(len, length_temp)

    return len


if __name__ == "__main__":
    nums = [0, 3, 7, 2, 5, 8, 4, 6, 0, 1]
    print(solve(nums))
